package cn.cvs.redisdemo.controller;

import cn.cvs.redisdemo.dao.BookDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BookController {
    @Autowired
    BookDao bookDao;

    @GetMapping("/save")
    @ResponseBody
    public String save(){
        bookDao.saveBook("redis","spring-boot-starter-data-redis");
        return "保存键值对成功";
    }

    @GetMapping("/getSave")
    @ResponseBody
    public String getSave(){
        return bookDao.getValue("redis");
    }
}
